<%@ page contentType="text/html;charset=utf-8" %>
<%@ include file="../common/taglib.jsp" %> 
<%@page import="website.WebSiteAction"%>
<%@page import="java.util.Map"%>

<%
	WebSiteAction.getColumnById(request);
	//Map<String,Object> configMap = WebSiteAction.getWebsiteConfig(request);
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="MSG_CONTENT-Type" MSG_CONTENT="text/html; charset=utf-8" />
<title>客户留言</title>
<%@ include file="import.jsp" %> 
<script src="${ctx}/static/scripts/Map.js" type="text/javascript"></script>
<script src="${ctx}/static/scripts/HttpController.js" type="text/javascript"></script>

<script language="JavaScript"> 

	function checkForm() {
		var obj = document.msgForm;
		if (obj.USER_NAME.value == '') {
			alert('您的姓名没有填写！\n\n注意 * 号项必需填写！');
			obj.USER_NAME.focus();
			return false;
		}

		if (obj.TEL.value == '') {
			alert('您的联系电话没有填写！\n\n注意 * 号项必需填写！');
			obj.TEL.focus();
			return false;
		}

		if (obj.MSG_TITLE.value == '') {
			alert('您的留言标题没有填写！\n\n注意 * 号项必需填写！');
			obj.MSG_TITLE.focus();
			return false;
		}

		if (obj.MSG_CONTENT.value == '') {
			alert('您的留言内容没有填写！\n\n注意 * 号项必需填写！');
			obj.MSG_CONTENT.focus();
			return false;
		}
		return true;

	}
	
	//提交留言
	function doSaveMsg() {
		if(checkForm() == true) {
			var form = document.msgForm;
			var httpController = new HttpController();
			
			var paraNameArr = ["USER_NAME","COMPANY","TEL","FAX","EMAIL","ADDRESS","MSG_TITLE","MSG_CONTENT"];
			for(var i = 0;i<paraNameArr.length;i++) {
				httpController.addParameter(paraNameArr[i], form[paraNameArr[i]].value);
			}
			httpController.executeHttp("${ctx}/services?action=website.WebSiteAction&operate=doSaveMsg&tableName=WEBSITE_MSG", function(result) {
				//alert(result);
				if(result == '1') {
					alert("提交成功！");
					form.reset();
				} else {
					alert("提交失败！");
				}
			});
		}
	}
	
</script>

</head>

<body>
	<!-- 头部 -->
    <%@ include file="top.jsp" %> 
    
    <!-- 菜单下的图片 -->
    <div class="advx" style="background:url(${ctx}${menuColumn.IMAGE_PATH}) #fff no-repeat center 0;"></div>
    
    <div class="content">
        <div class="main">
            <!-- 左边 -->
    		<%@ include file="left.jsp" %>

			<div class="com_right">
			    <div class="right_head">
			        <h3>${menuColumn.NAME}</h3>
			        <span><a href="${ctx}/frontpage/index.jsp">首页</a> > ${menuColumn.NAME}</span>
			    </div>
			    <div class="right_con">
					<!-- 留言内容开始 -->
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td height="30">尊敬的客户，请在这里留言给我们(请留下联系方式)，我们会及时回复，谢谢！(<font
								color="#FF0000">*</font> 号项必需填写)
							</td>
						</tr>
					</table>
					<br>
					
					<TABLE width="566" border=0 align="center" cellPadding=2
						cellSpacing=1>
						<form name="msgForm" method="post" action=""
							onsubmit="return checkForm();">
							<tr>
								<TD width="73" align="right" ><font
									color="#FF0000">*</font>姓名：</TD>
								<TD width="170" align="left"><input name="USER_NAME"
									type="text" class="InputBorder" id="USER_NAME" size="25"></TD>
							</TR>
							<tr>
								<TD align="right" >公司名：</TD>
								<TD colspan="3" align="left"><input name="COMPANY"
									type="text" class="InputBorder" id="COMPANY" size="66" ></TD>
							</TR>
							<tr>
								<TD align="right" ><font color="#FF0000">*</font>电话：</TD>
								<TD align="left"><input name="TEL" type="text"
									class="InputBorder" id="TEL" size="25"></TD>
								<TD align="right" >传真：</TD>
								<TD align="left"><input name="FAX" type="text"
									class="InputBorder" id="FAX" size="25"></TD>
							</TR>
							<tr>
								<TD align="right" >E-mail：</TD>
								<TD colspan="3" align="left"><input name="EMAIL"
									type="text" class="InputBorder" id="EMAIL" size="66"></TD>
							</TR>
							<tr>
								<TD align="right" >地址：</TD>
								<TD colspan="3" align="left"><input name="ADDRESS"
									type="text" class="InputBorder" id="ADDRESS" size="66"></TD>
							</TR>
							<tr>
								<TD align="right" ><font color="#FF0000">*</font>留言标题：</TD>
								<TD colspan="3" align="left"><input name="MSG_TITLE"
									type="text" class="InputBorder" id="MSG_TITLE" size="66"></TD>
							</TR>
							<tr>
								<TD align="right" ><font color="#FF0000">*</font>留言内容：</TD>
								<TD colspan="3" align="left"><textarea name="MSG_CONTENT"
										cols="15" rows="8" class="InputBorder" id="MSG_CONTENT"
										style="width: 100%"></textarea></TD>
							</TR>
							<tr>
								<TD height="30" colspan="4" align="center" >
									<input type="button" name="Submit" onclick="doSaveMsg()" value="提交我的留言">
								</TD>
							</TR>
						</form>
					</table>
					<!-- 留言内容结束 -->
				</div>
			</div>

		</div>
    </div>
    
    <!-- 底部 -->
    <%@ include file="bottom.jsp" %> 
</body>
</html>
